﻿using Core.CSV;
using Game.WeaponComponent;

namespace Game {
    public class DoubleSpawnForNextEffect : WeaponEffect {
        public DoubleSpawnForNextEffect(TBWeaponEffectConfig config) : base(config) { }

        protected override void onTrigger() {
            if (mIndex + 1 >= mEffectList.Count || mEffectList[mIndex + 1] == default) {
                return;
            }

            
            
            foreach (var component in mEffectList[mIndex + 1].GetAll<BaseSpawnerComponent>()) {
                component.SpawnNum *= 2;
            }
        }

        protected override void onTriggerEnd() {
            if (mIndex + 1 >= mEffectList.Count || mEffectList[mIndex + 1] == default) {
                return;
            }
            
            foreach (var component in mEffectList[mIndex + 1].GetAll<BaseSpawnerComponent>()) {
                component.SpawnNum /= 2;
            }
        }
    }
}